<template>
  <el-row>
    <el-col :span="8">
      <el-card class="box-card">
        <div class="user">
          <img
            src="https://img.5211game.com/9211/homepage/images/name.jpg"
            alt=""
          />
          <div class="user-info">
            <p class="name">admin</p>
            <p class="access">超级管理员</p>
          </div>
        </div>
        <div class="login-info">
          <p>上次登录时间：<span>202402.04</span></p>
          <p>上次登录地点：<span>上海</span></p>
        </div>
      </el-card>
      <el-card style="margin-top: 20px; height: 460px">
        <el-table :data="tableData" style="width: 100%">
          <el-table-column
            :prop="key"
            :label="val"
            v-for="(val, key) in tableLabel"
            v-bind:key="key"
          >
          </el-table-column>
        </el-table>
      </el-card>
    </el-col>
    <el-col :span="16" style="padding-left: 20px">
      <div class="num">
        <el-card
          v-for="(item, index) in countData"
          v-bind:key="index"
          :body-style="{ display: 'flex' }"
        >
          <i
            class="icon"
            :class="`el-icon-${item.icon}`"
            v-bind:style="{ background: item.color, padding: 0 }"
          ></i>
          <div class="detail">
            <p class="price">{{ item.value }}</p>
            <p class="desc">{{ item.name }}</p>
          </div>
        </el-card>
      </div>
      <div>
        <el-card>
          321321231
        </el-card>
      </div>
    </el-col>
  </el-row>
</template>
<script>


export default {
  name: 'Home',
  data () {
    return {
      tableData: [
        { name: 'oppo', todayBuy: 100, monthBuy: 300, totalBuy: 800 },
        { name: '三星', todayBuy: 300, monthBuy: 300, totalBuy: 800 },
        { name: '魅族', todayBuy: 120, monthBuy: 300, totalBuy: 800 },
        { name: '苹果', todayBuy: 10000, monthBuy: 300, totalBuy: 800 },
        { name: 'vivo', todayBuy: 100, monthBuy: 300, totalBuy: 800 }
      ],
      tableLabel: { name: '手机型号', todayBuy: '今日购买', monthBuy: '本月购买', totalBuy: '总购买' },
      countData: [{
        name: '今日支付订单',
        value: 1234,
        icon: 'success',
        color: "#2ec7c9"
      },
      {
        name: '今日未支付订单',
        value: 1234,
        icon: 's-goods',
        color: "#5ab1ef"
      },
      {
        name: '本月支付订单',
        value: 1234,
        icon: 'success',
        color: "#2ec7c9"
      },
      {
        name: '本月未支付订单',
        value: 1234,
        icon: 's-goods',
        color: "#5ab1ef"
      },
      {
        name: '本月收藏订单',
        value: 2100,
        icon: 'star-on',
        color: "#ffb980"
      },
      {
        name: '本月未收藏订单',
        value: 2100,
        icon: 'star-off',
        color: "#ffb980"
      }
      ]
    }
  },
  mounted () {
    console.log(this.tableData)
  }
}
</script>

<style lang="less" scoped>
.user {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  img {
    margin-right: 40px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
  }
  .user-info {
    .name {
      font-size: 32px;
      margin-bottom: 10px;
    }
    .access {
      color: #999;
    }
  }
}
.login-info {
  p {
    line-height: 28px;
    font-size: 14px;
    color: #999;
    span {
      color: #666;
      margin-left: 60px;
    }
  }
}
.num {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .el-card {
    width: 32%;
    margin-bottom: 20px;
  }
  .icon {
    width: 80px;
    height: 80px;
    font-size: 18px;
    line-height: 80px;
    text-align: center;
    color: #fff;
  }
  .detail {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 15px;
    .price {
      font-size: 30px;
      margin-bottom: 10px;
      height: 30px;
      line-height: 30px;
    }
    .desc {
      font-size: 14px;
      text-align: center;
      color: #999;
    }
  }
}
</style>
